#!/bin/bash

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"

set -e

notice() {
    echo -e "\033[36m $1 \033[0m "
}

res_dir="$root_dir/tmp/bili/resources"

"$root_dir/tools/update-electron"
"$root_dir/tools/update-bilibili"
"$root_dir/tools/fix-other.sh"
"$root_dir/tools/area-unlimit.sh"

mv "$res_dir/"* "$root_dir/app"